<%@ page import="java.util.List" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>在线用户列表 </title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css">

    <script src="../static/js/jquery.js"></script>
    <script src="../static/bootstrap/js/bootstrap.js"></script>
</head>
<body>
<%
    // 从上下文中获取已经登录账号的集合
    List<String> onLineUserList =
            (List<String>) request.getServletContext().getAttribute("onLineUserList");
    if (onLineUserList != null) {
%>
<h3>当前在线用户人数:<%=onLineUserList.size()%></h3>
<div class="table" style="width: 50%">
    <table class="table table-bordered text-center">
        <tr class="table-primary">
            <th>在线用户</th>
        </tr>
        <%
            for (String username : onLineUserList) {
        %>
        <tr>
            <th><%=username%></th>
        </tr>
        <%
            }
        %>
    </table>
</div>
<%
    }
%>

</body>
</html>
